package com.smartwebx.ha.dal.feature.sqlprovider;

import static org.apache.ibatis.jdbc.SqlBuilder.BEGIN;
import static org.apache.ibatis.jdbc.SqlBuilder.FROM;
import static org.apache.ibatis.jdbc.SqlBuilder.SELECT;
import static org.apache.ibatis.jdbc.SqlBuilder.SQL;
import static org.apache.ibatis.jdbc.SqlBuilder.WHERE;

import java.util.Map;

import com.smartwebx.ha.dal.config.OracleConfigInfo;

public class FeatureRsvrMapperProvider {
	private String TZ_DRZMY_T = OracleConfigInfo.FEATURE_NAME + ".TZ_DRZMY_T";

	public String getPeriodAvgContrastWaterSQL(Map<String, Integer> maps) {
		Integer startMonth = maps.get("startMonth");
		Integer startDay = maps.get("startDay");
		Integer endMonth = maps.get("endMonth");
		Integer endDay = maps.get("endDay");
		maps.put("firstParam", (startMonth * 100 + startDay));
		maps.put("sencondParam", (endMonth * 100 + endDay));

		BEGIN();
		SELECT("MNTH,DAY,AVRZ avgWater");
		FROM(TZ_DRZMY_T);
		WHERE("stcd = #{stcd}");
		WHERE("(MNTH * 100 +DAY) >= #{firstParam}");
		WHERE("(MNTH * 100 + DAY) <= #{sencondParam}");
		return SQL();
	}
}
